<?php

namespace App\Models\WorkOrder;

use App\Models\BaseModel;
use App\Models\Traits\KfSoftDeletes;
use App\Models\Traits\KfUid;

class WorkOrderRejectDetailModel extends BaseModel
{
    use KfUid;
    use KfSoftDeletes;

    protected $table = 'work_order_reject_details';

    protected $fillable = [
        'workOrderNo',
        'rejectId',
        'field',
        'fieldText',
        'fieldValue',
        'reasonOptionText',
        'reasonText',
        'createdByUid',
        'updatedByUid',
        'createdAt',
        'updatedAt',
        'isDeleted',
    ];

    public static function delData(string $workOrderNo, array $fields): int
    {
        return self::query()->where('workOrderNo', $workOrderNo)->whereIn('field', $fields)->update(['isDeleted' => 1]);
    }
}
